-- queen_trans
-- created by zhuangsl
-- 皇后切换形态

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 每回合触发
    trigger = function(who, prop, arg)
        if who.type ~= OBJECT_TYPE_USER then
            return;
        end

        -- 如果转换点还未满
        local curPoint = DungeonServiceM.queryDungeonAttrib("trans_point");
        if curPoint < DungeonServiceM.getDungeonAttribInfo("trans_point", "limit") then
            return;
        end

        -- 先清空转换点
        DungeonServiceM.costDungeonAttrib({["trans_point"] = curPoint});

        -- 转换形态
        local level = prop[3];
        local condition = {
            ["value"] = 50 * level,
            ["end_round"] = -1;
        }

        -- 如果当前处于光明形态，则转换为暗影形态；否则转换为光明形态
        if CombatStatusM.checkStatus(who, "light_form") then
            condition["shape_id"] = 8;
            CombatStatusM.applyStatus(who, "shadow_form", condition);
        else
            condition["level"] = level;
            CombatStatusM.applyStatus(who, "light_form", condition);
        end

        -- 触发特技发动事件
        EventMgr.fire(event.SPECIAL_SKILL_TRIGGER, { propId = prop[1], });
    end,

    record = function(target, prop, path)
        return false;
    end
};
